<#include "/WEB-INF/default/fragment/header.ftl">
<body>

<#include "/WEB-INF/default/fragment/nav.ftl">

<div class="container">
  <div class="tms-logo"><img class="center-block" src="${request.contextPath}/assets/images/logo.png?t=${assetsTimestamp}" alt=""></div>
</div>

<div class="container">
<form class="form-horizontal">

  <legend class="clearfix">
    <div class="pull-left"><h4>${user.nickname}的个人主页</h4></div>
    <div class="pull-right">
      <button type="submit" class="btn btn-success">邀请${user.nickname}加入我的团队</button>
    </div>
  </legend>

  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">基本信息</h3>
    </div>
    <div class="panel-body">
      <table class="table">
        <thead> 
          <tr> 
            <th>id</th> 
            <th>昵称</th> 
            <th>邮箱</th> 
            <th>注册时间</th> 
            <th>注册IP</th> 
            <th>最后登录时间</th>
            <th>最后登录IP</th>
          </tr> 
        </thead>
        <tbody> 
          <tr> 
            <td>${user.id}</td> 
            <td>${user.nickname}</td> 
            <td>${user.email}</td> 
            <td>${(user.gmtCreate*1000)?number_to_datetime}</td>
            <td>${user.ipReg}</td>
            <td><#if user.gmtModified??><#else>${(user.gmtModified*1000)?number_to_datetime}</#if></td>
            <td>${user.ipLogin!""}</td>
          </tr> 
        </tbody>
      </table>
    </div>
  </div>

  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">${user.nickname}的任务列表</h3>
    </div>
    <div class="panel-body">
      <table class="table">
        <thead>
          <tr>
            <th>id</th>
            <th>项目</th>
            <th>任务名称</th>
            <th>任务开始时间\截止时间</th>
            <th>附件</th>
            <th>完成状态</th>
            <th>完成备注</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          <#list userTasks as userTask>
          <tr>
            <td>${userTask.task.id}</td>
            <td>${userTask.project.title?html}</td>
            <td><a href="${request.contextPath}/task-detail.action?task.id=${userTask.task.id}">${userTask.task.title?html}</a></td>
            <td>
              <p>${(userTask.gmtCreate*1000)?number_to_datetime}</p>
              <p>${(userTask.gmtExpires*1000)?number_to_datetime}<#if (userTask.gmtExpires-now) lt 0>（已截止）<#else>（剩余${((userTask.gmtExpires-now)/60/60)?floor}小时）</#if></p>
            </td>
            <td class="btn-group-xs">
              <#if userTask.task.attachmentUrl != "">
              <a class="btn btn-default" href="${userTask.task.attachmentUrl}">下载参考附件</a>
              <#else>
              <span class="text-muted">（无）</span>
              </#if>
            </td>
            <td>
            <#if userTask.status == 0><span class="text-muted">尚未提交</span></#if>
            <#if userTask.status == 1><span class="text-warning">已提交</span></#if>
            <#if userTask.status == 2><span class="text-success">已确认</span></#if>
            </td>
            <td>
              <p style="width:100px;">${userTask.remark!""}</p>
              <#if userTask.attachmentUrl != "">
              <a class="btn btn-default btn-xs" href="${userTask.attachmentUrl}">完成附件</a>
              </#if>
            </td>
            <td class="btn-group-xs">
              <#if userTask.status == 0>
              <a class="btn btn-primary btn-xs" href="${request.contextPath}/task-detail.action?task.id=${userTask.task.id}">提交任务</a>
              </#if>
              <#if userTask.status == 1>
              <a class="btn btn-success btn-xs j_finish_task" data-user-task-id="${userTask.id}" href="###">确认任务</a>
              </#if>
              <#if userTask.status == 2>
              <span class="text-info">任务已确认</span>
              </#if>
            </td>
          </tr>
          <#else>
          <tr>
            <td colspan="9">还没有分配过</td>
          </tr>
          </#list>
        </tbody>
      </table>
    </div>
  </div>


  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">${user.nickname}创建的团队</h3>
    </div>
    <div class="panel-body">
      <table class="table">
        <thead>
          <tr>
            <th>团队id</th>
            <th>团队名称</th>
            <th>团队描述</th>
            <th>个性域名</th>
            <th>成员</th>
            <th>开始、结束时间</th>
            <th>团队状态</th>
            <th>完成度</th>
          </tr>
        </thead>
        <tbody>
          <#list teams as team>
          <tr>
            <td>${team.id}</td>
            <td><a href="${request.contextPath}/team-${team.id}.action">${team.name}</a></td>
            <td>${team.desc}</td>
            <td>${team.subdomain}</td>
            <td>${team.userCount}</td>
            <td>${(team.gmtBegin*1000)?number_to_date?string("yyyy-MM-dd") }&nbsp;/&nbsp;${(team.gmtEnd*1000)?number_to_date?string("yyyy-MM-dd")}</td>
            <td>
              <#if team?exists && team.status == 1>尚未开始</#if>
              <#if team?exists && team.status == 2>正在实训中</#if>
              <#if team?exists && team.status == 3>毕业项目实战</#if>
              <#if team?exists && team.status == 4>完成实训</#if>
              <#if team?exists && team.status == 5>结束团队</#if>
            </td>
            <td>
              <@team_process team.gmtBegin team.gmtEnd />
            </td>
          </tr>
          <#else>
          <tr>
            <td colspan="9">还没有创建过团队</td>
          </tr>
          </#list>
        </tbody>
      </table>
    </div>
  </div>

  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">${user.nickname}加入的团队</h3>
    </div>
    <div class="panel-body">
      <table class="table">
        <thead>
          <tr>
            <th>团队id</th>
            <th>团队名称</th>
            <th>团队描述</th>
            <th>个性域名</th>
            <th>成员</th>
            <th>开始、结束时间</th>
            <th>团队状态</th>
            <th>完成度</th>
          </tr>
        </thead>
        <tbody>
          <#list userTeams as ut>
          <tr>
            <td>${ut.team.id}</td>
            <td><a href="${request.contextPath}/team-${ut.team.id}.action">${ut.team.name}</a></td>
            <td>${ut.team.desc}</td>
            <td>${ut.team.subdomain}</td>
            <td>${ut.team.userCount}</td>
            <td>${(ut.team.gmtBegin*1000)?number_to_date?string("yyyy-MM-dd") }&nbsp;/&nbsp;${(ut.team.gmtEnd*1000)?number_to_date?string("yyyy-MM-dd")}</td>
            <td>
              <#if ut.team?exists && ut.team.status == 1>尚未开始</#if>
              <#if ut.team?exists && ut.team.status == 2>正在实训中</#if>
              <#if ut.team?exists && ut.team.status == 3>毕业项目实战</#if>
              <#if ut.team?exists && ut.team.status == 4>完成实训</#if>
              <#if ut.team?exists && ut.team.status == 5>结束团队</#if>
            </td>
            <td>
              <@team_process ut.team.gmtBegin ut.team.gmtEnd />
            </td>
          </tr>
          <#else>
          <tr>
            <td colspan="9">还没有加入过团队</td>
          </tr>
          </#list>
        </tbody>
      </table>
    </div>
  </div>

  <script src="${request.contextPath}/assets/js/app.js?t=${assetsTimestamp}"></script>

</form>
</div>

</body>
<#include "/WEB-INF/default/fragment/footer.ftl">
